<template>
  <div id="todo_add">
    <input type="text" @keyup.enter="emitAddTodo" v-model="todo_text">
    <button @click="emitAddTodo"><i class="plus"></i></button>
  </div>
</template>

<script>
export default {
  name: "Todo_add",
  data:()=>{
    return {
      todo_text:"",
    }
  },
  methods:{
    emitAddTodo:function (){
      const todo  = {"todo_id":this.todo_id+1,"todo_text":this.todo_text,checked:false};
      this.$emit('add_todo',todo);
      this.todo_text="";
    }
  },
  props:{
    todo_id:NaN
  },
  mounted() {
  }
}
</script>

<style scoped>

#todo_add{
  position: relative;
  display: flex;
  align-items: center;
}

input{
  display: inline-block;
  width: 80%;
  padding: 16px 52px 16px 18px;
  border-radius: 48px;
  border: none;
  outline: none;
  box-shadow: 0px 0px 24px rgba(0,0,0,0.08);
  font-size: 16px;
  color: #626262;
}

.todo_add button{
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(#c0a5f3,#7f96f7);
  border: none;
  outline: none;
  color: white;
  position: absolute;
  right: 0;
}

.plus{
  display: inline-block;
  width: 50px;
  height: 50px;
  background: linear-gradient(#fff,#fff),linear-gradient(#fff,#fff);
  background-size: 50% 2px ,2px 50%;
  background-position: center;
  background-repeat: no-repeat;
  margin-left: -5px;
}


</style>